package com.project.controller;

import com.project.bean.CategoryBean;
import com.project.bean.CommentBean;
import com.project.service.ICategoryService;
import com.project.service.ICommentService;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("category")
public class CategoryController {
    @Autowired
    private ICategoryService categoryService;
    @PostMapping("add")
    /**添加列表*/
    public String add (CategoryBean categoryBean){
        categoryService.add(categoryBean);
        return "添加成功";
    }
    @DeleteMapping("del")
    public String del(Integer id){
        categoryService.del(id);
        return "删除成功";
    }
    @PutMapping("upd")
    public String upd(Integer id,String name){
        categoryService.upd(id, name);
        return "修改成功";
    }
}
